<?php
	include "layout.php";
	
	head("New Deposit");
?>
<h1>Add a New Deposit</h1>
<?php 
	if (isset($_POST["submit"])) {
		add_deposit();
	}
?>
<form name="adddeposit" action="adddeposit.php" method="post" onsubmit="return validateDepositForm()">
	<label for="value">Deposit Size:</label>
	<input type="text" name="value" placeholder="Deposit Size" /><br />
	<label for="rmtype">RM Type:</label>
	<select name="rmtype">
		<option value=0>--</option>
		<?php 
			$rmtypes = mysql_query("SELECT * FROM rmtypes ORDER BY id");
			while ($rmytype = mysql_fetch_array($rmtypes)) {
				echo "<option value={$rmytype["id"]}>{$rmytype["name"]}</option>";
			}
		?>
	</select><br />
	<label for="planet">Planet:</label>
	<select name="planet" onchange="showSize(this.value)">
		<option value="">--</option>
		<?php
			$planets = mysql_query("SELECT * FROM planets ORDER BY id");
			while ($planet = mysql_fetch_array($planets)) {
				echo "<option value={$planet["id"]}>{$planet["name"]}</option>";
			}
		?>
	</select><br />
	<label for="terrain">Terrain:</label>
	<select name="terrain">
		<option value="">--</option>
		<?php
			$terrains = mysql_query("SELECT * FROM terrain ORDER BY id");
			while ($terrain = mysql_fetch_array($terrains)) {
				echo "<option value={$terrain["id"]}>{$terrain["name"]}</option>";
			}
		?>
	</select><br />
	<label for="x">X-Coordinate:</label>
	<select name="x" id="x">
		<option value=""></option>
	</select><br />
	<label for="y">Y-Coordinate:</label>
	<select name="y" id="y">
		<option value="">--</option>
	</select><br />
	<input type="submit" name="submit" value="Create"/> 
</form>
<?php 
	foot();
?>